/*
 * @Author: sky 1575951471@qq.com
 * @Date: 2024-11-12 22:26:36
 * @LastEditors: sky 1575951471@qq.com
 * @LastEditTime: 2024-12-03 21:53:23
 * @FilePath: \sky-esp32-Base\main\APP\wifi_demo.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

#if 0
#include "esp_wifi.h"
// #include "wifi_config.h"
#include "esp_event.h"
#include "wifi_demo.h"
#include "esp_log.h"

wifi_init_config_t sky_wificof;
uint8_t sky_ssid[32] = "HUAWEI-sky";
uint8_t sky_password[64] = "gz20230109";

static void sky_wifi_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
{
    static int retry_num = 0;
    if((event_base == WIFI_EVENT) && (event_id == WIFI_EVENT_STA_START))                                            //wifi启动
    {
        esp_wifi_connect();
    }
    else if((event_base == WIFI_EVENT)&&(event_id == WIFI_EVENT_STA_)
}


void sky_wifista_init(void)
{
    wifi_config_t wifi_info;
    wifi_info.sta.ssid = sky_ssid;
    wifi_info.sta.password = sky_password;
    
    /*wifi/Lwip初始化阶段*/
    esp_netif_init();                   /* 创建LwIP核心任务*/
    esp_event_loop_create_default();
    esp_netif_create_default_wifi_sta();
    esp_wifi_init(&sky_wificof);
    ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &sky_wifi_event_handler, NULL));
    ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &sky_wifi_event_handler, NULL));

    /*wifi 配置阶段*/
    esp_wifi_set_mode(WIFI_MODE_STA);
    esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_info);
    ESP_ERROR_CHECK(esp_wifi_start());                                                                              //启动wifi

    
}

#endif